
//---------------------------------------------------------------------------
#ifndef PG1_MAP_H
#define PG1_MAP_H
//---------------------------------------------------------------------------
#include "pg1_api.h"
//---------------------------------------------------------------------------
#include "entities/pg1_entity2d.h"
#include "rendering/pg1_rendertypes.h"
#include <vector>
#include <map>
//---------------------------------------------------------------------------
namespace pg1
{
//---------------------------------------------------------------------------
class Renderer;
class Sprite;
//---------------------------------------------------------------------------
class PG1_API Map : public Entity2D
{
// constructor
public:
	Map ();
	~Map ();


// tiles
public:
	class Tile 
	{
	public:
		Tile (bool bCollides = false);
		Tile (const Tile& rkTile);

		bool collides () const;

	private:
		bool m_bCollides;
	};

	const Tile& tile (unsigned int uiId) const;
	void setTile (unsigned int uiId, const Tile& rkTile);

	static const Tile NoTile;
	
private:
	std::map<unsigned int, Tile> m_kTiles;
	Tile** m_apkMap;


// map 
public:
	void setDimensions (size_t uiWidth, size_t uiHeight);
	void setTileDimensions (size_t uiTileWidth, size_t uiTileHeight);

private:
	size_t m_uiWidth, m_uiHeight;
	size_t m_uiTileWidth, m_uiTileHeight;


// rendering
public:
	void setTexture (const Texture& rkTexture);
	void draw (Renderer& rkRenderer) const;

private:
	Texture m_kTexture;
};
//---------------------------------------------------------------------------
#include "pg1_map.inl"
//---------------------------------------------------------------------------
} // end namespace
//---------------------------------------------------------------------------
#endif // PG1_MAP_H
//---------------------------------------------------------------------------
